﻿<Window x:Class="RemoteTestRunner.FormsUI.Wpf.ProjectAdmin"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Project Administration" Height="300" Width="600" >
    <Grid  >
        <Grid.ColumnDefinitions >
            <ColumnDefinition Width="1*" />
            <ColumnDefinition Width="2*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions >
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <TreeView 
            ItemsSource="{Binding Path=Projects}"
            Name="tvwProjects" 
            SelectedItemChanged="tvwProjects_SelectedItemChanged"
            >
            <TreeView.ItemTemplate>
                <HierarchicalDataTemplate ItemsSource="{Binding Tests}"   >
                    <HierarchicalDataTemplate.ItemContainerStyle>
                        <Style TargetType="TreeViewItem">
                            <Setter Property="IsExpanded" Value="True" />
                        </Style>
                    </HierarchicalDataTemplate.ItemContainerStyle>
                    <StackPanel Orientation="Horizontal" >
                        <Label Padding="0" Content="Project: " ></Label>
                        <Label Padding="0" Content="{Binding Name}" ></Label>
                    </StackPanel>
                    <HierarchicalDataTemplate.ItemTemplate >
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" >
                                <Label Padding="0" Content="Test: " ></Label>
                                <Label Padding="0" Content="{Binding Name}"></Label>
                            </StackPanel>
                        </DataTemplate>
                    </HierarchicalDataTemplate.ItemTemplate>
                </HierarchicalDataTemplate>
            </TreeView.ItemTemplate>
            <!--<TreeViewItem Header="test">
                <TreeViewItem Header="abc" >
                    
                </TreeViewItem>
            </TreeViewItem>-->
        </TreeView>
        <StackPanel Grid.Row="1" Orientation="Vertical">
            <StackPanel Orientation="Horizontal" >
                <Button Margin="2" Command="{Binding AddProjectCommand}" CommandParameter="{Binding ElementName=tvwProjects, Path=SelectedItem}" >Add _Project</Button>
                <Button Margin="2" Command="{Binding AddTestCommand}" CommandParameter="{Binding ElementName=tvwProjects, Path=SelectedItem}" >Add _Test</Button>
            </StackPanel>
            <StackPanel Orientation="Horizontal" >
                <Button Margin="2" Command="{Binding DeleteProjectCommand}" CommandParameter="{Binding ElementName=tvwProjects, Path=SelectedItem}" >Delete P_roject</Button>
                <Button Margin="2" Command="{Binding DeleteTestCommand}" CommandParameter="{Binding ElementName=tvwProjects, Path=SelectedItem}" >Delete T_est</Button>
            </StackPanel>
        </StackPanel>
        <StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" FlowDirection="RightToLeft" >
            <Button IsCancel="True" Margin="2" Command="{Binding CancelCommand}">_Cancel</Button>
            <Button Margin="2" Command="{Binding SaveCommand}">_Save</Button>
        </StackPanel>
        <Grid Grid.Column="1">
            <Grid.RowDefinitions >
                <RowDefinition Height="Auto"  />
                <RowDefinition Height="Auto"  />
                <RowDefinition />
            </Grid.RowDefinitions>
            <GroupBox Header="Project Details">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>

                    </Grid.RowDefinitions>
                    <Label Grid.Row="0">_Project Name:</Label>
                    <TextBox Grid.Column="1" Text="{Binding SelectedProject.Name}"></TextBox>
                </Grid>
            </GroupBox>
            <GroupBox Header="Test Details" Grid.Row="1" >
                <Grid>
                    <Grid.RowDefinitions >
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions >
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition />
                        <ColumnDefinition Width="25" />
                    </Grid.ColumnDefinitions>
                    <Label Grid.Row="0">Test _Name:</Label>
                    <Label Grid.Row="1">Test _Assembly:</Label>
                    <Label Grid.Row="2">Configuration _File:</Label>
                    <Label Grid.Row="3">_Run Config File:</Label>

                    <TextBox Grid.Column="1" Grid.ColumnSpan="2" Text="{Binding SelectedTest.Name}"></TextBox>
                    <TextBox Grid.Column="1" Grid.Row="1" Text="{Binding SelectedTest.AssemblyPath}" ></TextBox>
                    <TextBox Grid.Column="1" Grid.Row="2" Text="{Binding SelectedTest.ConfigPath}" ></TextBox>
                    <TextBox Grid.Column="1" Grid.Row="3" Text="{Binding SelectedTest.RunConfigPath}" ></TextBox>

                    <Button Grid.Row="1" Grid.Column="2">...</Button>
                    <Button Grid.Row="2" Grid.Column="2">...</Button>
                    <Button Grid.Row="3" Grid.Column="2">...</Button>
                </Grid>
            </GroupBox>
            <GroupBox Grid.Row="2" Header="Data Sources" >
                <Grid>
                    <ListView></ListView>
                </Grid>
            </GroupBox>
        </Grid>
    </Grid>
</Window>
